import { getDefaultProvider } from "@ethersproject/providers";
import { ChainId, Fetcher, Route, WETH } from "@pancakeswap-libs/sdk";

export async function demoRouter() {
    const provider = getDefaultProvider('https://bsc-dataseed1.binance.org')
    const busd = await Fetcher.fetchTokenData(ChainId.MAINNET, '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', provider)
    console.log('fetchPairData bnb_busd')
    const bnb_busd = await Fetcher.fetchPairData(WETH[busd.chainId], busd, provider)
    const bnb_busd_route = new Route([bnb_busd], WETH[busd.chainId])
    console.log(bnb_busd_route.midPrice.numerator.toString(10))
    console.log(bnb_busd_route.midPrice.denominator.toString(10))
    console.log('bnb/busd price = ' + bnb_busd_route.midPrice.toSignificant(8))
}